package com.link2room.optimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 价格池
 * Created by sss on 2016/8/25.
 */
@Entity
@Table(name = "price_pool", catalog = "")
@DynamicInsert
public class PricePool  extends BaseEntity {
    public enum PricePool_{
        poolCode,poolName,descript,addValue,multiplyValue,carryType
    }
    /**
     * 价格池代码
     */
    private String poolCode;
    /**
     * 价格池名字
     */
    private String poolName;
    /**
     * 价格池描述
     */
    private String descript;
    /**
     * 四舍五入内容
     */
    private String carryType;
    /**
     * 加价数值(底价)
     */
    private BigDecimal addValueCost;
    /**
     * 乘法系数(底价)
     */
    private BigDecimal multiplyValueCost;
    /**
     * 加价数值(卖价)
     */
    private BigDecimal addValueSale;
    /**
     * 乘法系数(卖价)
     */
    private BigDecimal multiplyValueSale;

    @Basic
    @Column(name = "pool_code", nullable = false, length = 32)
    public String getPoolCode() {
        return poolCode;
    }

    public void setPoolCode(String poolCode) {
        this.poolCode = poolCode;
    }

    @Basic
    @Column(name = "pool_name", nullable = false, length = 64)
    public String getPoolName() {
        return poolName;
    }

    public void setPoolName(String poolName) {
        this.poolName = poolName;
    }

    @Basic
    @Column(name = "descript", nullable = true, length = 255)
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Basic
    @Column(name = "carry_type", nullable = false, length = 16)
    public String getCarryType() {
        return carryType;
    }

    public void setCarryType(String carryType) {
        this.carryType = carryType;
    }

    @Basic
    @Column(name = "add_value_cost", nullable = true, precision = 2)
    public BigDecimal getAddValueCost() {
        return addValueCost;
    }

    public void setAddValueCost(BigDecimal addValueCost) {
        this.addValueCost = addValueCost;
    }

    @Basic
    @Column(name = "multiply_value_cost", nullable = true, precision = 2)
    public BigDecimal getMultiplyValueCost() {
        return multiplyValueCost;
    }

    public void setMultiplyValueCost(BigDecimal multiplyValueCost) {
        this.multiplyValueCost = multiplyValueCost;
    }

    @Basic
    @Column(name = "add_value_sale", nullable = true, precision = 2)
    public BigDecimal getAddValueSale() {
        return addValueSale;
    }

    public void setAddValueSale(BigDecimal addValueSale) {
        this.addValueSale = addValueSale;
    }

    @Basic
    @Column(name = "multiply_value_sale", nullable = true, precision = 2)
    public BigDecimal getMultiplyValueSale() {
        return multiplyValueSale;
    }

    public void setMultiplyValueSale(BigDecimal multiplyValueSale) {
        this.multiplyValueSale = multiplyValueSale;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PricePool pricePool = (PricePool) o;

        if (poolCode != null ? !poolCode.equals(pricePool.poolCode) : pricePool.poolCode != null) return false;
        if (poolName != null ? !poolName.equals(pricePool.poolName) : pricePool.poolName != null) return false;
        if (descript != null ? !descript.equals(pricePool.descript) : pricePool.descript != null) return false;
        if (carryType != null ? !carryType.equals(pricePool.carryType) : pricePool.carryType != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = poolCode != null ? poolCode.hashCode() : 0;
        result = 31 * result + (poolName != null ? poolName.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        result = 31 * result + (carryType != null ? carryType.hashCode() : 0);
        return result;
    }


}
